passthrough: remove pointless error checks
authorKeir Fraser <keir.fraser@citrix.com>
Tue, 15 Sep 2009 08:06:46 +0000 (09:06 +0100)
committerKeir Fraser <keir.fraser@citrix.com>
Tue, 15 Sep 2009 08:06:46 +0000 (09:06 +0100)
map_domain_page() cannot return NULL. And if it could, both instances
changed here would leak memory in such a case.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
xen/drivers/passthrough/vtd/iommu.c
xen/include/asm-x86/hvm/svm/amd-iommu-proto.h

index c628d15ef848bf1ffd4bef859a8277f27c0d0c79..2b905ed3baa8c8d689ce4f02edafd6faa867baa9 100644 (file)
@@ -156,8 +156,6 @@ u64 alloc_pgtable_maddr(struct acpi_drhd_unit *drhd, unsigned long npages)
     if ( !pg )
         return 0;
     vaddr = map_domain_page(page_to_mfn(pg));
-    if ( !vaddr )
-        return 0;
     memset(vaddr, 0, PAGE_SIZE * npages);
 
     iommu_flush_cache_page(vaddr, npages);
index fa10c3a894f4f0b507df859fb7730cebcbfb8fc9..e6b8c8da2c4acd472de1c63ce58955c3993964e8 100644 (file)
@@ -131,8 +131,6 @@ static inline struct page_info* alloc_amd_iommu_pgtable(void)
     if ( pg == NULL )
         return 0;
     vaddr = map_domain_page(page_to_mfn(pg));
-    if ( vaddr == NULL )
-        return 0;
     memset(vaddr, 0, PAGE_SIZE);
     unmap_domain_page(vaddr);
     return pg;